hpet cpuidle: Observe IRQ-safe locking protocol.
authorKeir Fraser <keir.fraser@citrix.com>
Thu, 23 Oct 2008 11:01:03 +0000 (12:01 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Thu, 23 Oct 2008 11:01:03 +0000 (12:01 +0100)
Otherwise, may encounter deadlock.

Signed-off-by: Wei Gang <gang.wei@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
xen/arch/x86/hpet.c

index 5a660245b663c34e5cb27ced65a4ba5fbdb568ea..443d487f673b0906131cce9217b10abdd0246de1 100644 (file)
@@ -146,7 +146,7 @@ static void handle_hpet_broadcast(struct hpet_event_channel *ch)
     s_time_t now, next_event;
     int cpu;
 
-    spin_lock(&ch->lock);
+    spin_lock_irq(&ch->lock);
 
 again:
     ch->next_event = STIME_MAX;
@@ -171,7 +171,7 @@ again:
         if ( reprogram_hpet_evt_channel(ch, next_event, now, 0) )
             goto again;
     }
-    spin_unlock(&ch->lock);
+    spin_unlock_irq(&ch->lock);
 }
 
 void hpet_broadcast_init(void)
@@ -213,6 +213,7 @@ void hpet_broadcast_enter(void)
 {
     struct hpet_event_channel *ch = &hpet_event;
 
+    ASSERT(!local_irq_is_enabled());
     spin_lock(&ch->lock);
 
     disable_APIC_timer();